package learn.up.java.designMode.observer.javaobsersver;

import java.util.Observable;
import java.util.Observer;

/**
 *具体的观察者对象
 * @author NANUTO
 * @date 2017年11月27日 上午12:04:07
 */
public class ConcreteObserver implements Observer  {
	
	private String observerName;
	
	private String remindMessage;

	@Override
	public void update(Observable o, Object arg) {
		//推模式
		System.out.println(String.format("[%s]收到了信息：[%s]，记住要[%s]", this.observerName, arg, this.remindMessage));
		
		//拉模式
		System.out.println(String.format("[%s]收到了信息：[%s]，记住要[%s]", this.observerName,
				((ConcreteWeatherSubject)o).getWeatherContent(), this.remindMessage));
	}

	public String getObserverName() {
		return observerName;
	}

	public void setObserverName(String observerName) {
		this.observerName = observerName;
	}

	public String getRemindMessage() {
		return remindMessage;
	}

	public void setRemindMessage(String remindMessage) {
		this.remindMessage = remindMessage;
	}

}
